home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / hexa.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  6KB  |  221 lines

  1. /****************************************************************************
  2.  
  3. HEXA
  4.  
  5. driver by Howie Cohen
  6.  
  7. Memory map (prelim)
  8. 0000 7fff ROM
  9. 8000 bfff bank switch rom space??
  10. c000 c7ff RAM
  11. e000 e7ff video ram
  12. e800-efff unused RAM
  13.  
  14. read:
  15. d001      AY8910 read
  16. f000      ???????
  17.  
  18. write:
  19. d000      AY8910 control
  20. d001      AY8910 write
  21. d008      bit0/1 = flip screen x/y
  22.           bit 4 = ROM bank??
  23.           bit 5 = char bank
  24.           other bits????????
  25. d010      watchdog reset, or IRQ acknowledge, or both
  26. f000      ????????
  27.  
  28. NOTES:
  29.         Needs High score save and load (i think the high score is stored
  30.                 around 0xc709)
  31.  
  32. *************************************************************************/
  33.  
  34. #include "driver.h"
  35. #include "vidhrdw/generic.h"
  36.  
  37.  
  38.  
  39. void hexa_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  40. void hexa_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  41. WRITE_HANDLER( hexa_d008_w );
  42.  
  43.  
  44.  
  45. static struct MemoryReadAddress readmem[] =
  46. {
  47.     { 0x0000, 0x7fff, MRA_ROM },
  48.     { 0x8000, 0xbfff, MRA_BANK1 },
  49.     { 0xc000, 0xc7ff, MRA_RAM },
  50.     { 0xd001, 0xd001, AY8910_read_port_0_r },
  51.     { 0xe000, 0xe7ff, MRA_RAM },
  52.     { -1 } /* end of table */
  53. };
  54.  
  55. static struct MemoryWriteAddress writemem[] =
  56. {
  57.     { 0x0000, 0xbfff, MWA_ROM },
  58.     { 0xc000, 0xc7ff, MWA_RAM },
  59.     { 0xd000, 0xd000, AY8910_control_port_0_w },
  60.     { 0xd001, 0xd001, AY8910_write_port_0_w },
  61.     { 0xd008, 0xd008, hexa_d008_w },
  62.     { 0xd010, 0xd010, watchdog_reset_w },    /* or IRQ acknowledge, or both */
  63.     { 0xe000, 0xe7ff, videoram_w, &videoram, &videoram_size },
  64.     { -1 } /* end of table */
  65. };
  66.  
  67.  
  68.  
  69. INPUT_PORTS_START( hexa )
  70.     PORT_START    /* IN0 */
  71.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
  72.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
  73.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
  74.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  75.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  76.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
  77.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  78.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON2 )
  79.  
  80.     PORT_START    /* DSW */
  81.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Coinage ) )
  82.     PORT_DIPSETTING(    0x00, DEF_STR( 3C_1C ) )
  83.     PORT_DIPSETTING(    0x01, DEF_STR( 2C_1C ) )
  84.     PORT_DIPSETTING(    0x03, DEF_STR( 1C_1C ) )
  85.     PORT_DIPSETTING(    0x02, DEF_STR( 1C_2C ) )
  86.     PORT_DIPNAME( 0x04, 0x00, "Naughty Pics" )
  87.     PORT_DIPSETTING(    0x04, DEF_STR( Off ) )
  88.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  89.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Flip_Screen ) )
  90.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  91.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  92.     PORT_DIPNAME( 0x30, 0x30, "Difficulty?" )
  93.     PORT_DIPSETTING(    0x30, "Easy?" )
  94.     PORT_DIPSETTING(    0x20, "Medium?" )
  95.     PORT_DIPSETTING(    0x10, "Hard?" )
  96.     PORT_DIPSETTING(    0x00, "Hardest?" )
  97.     PORT_DIPNAME( 0x40, 0x40, "Pobys" )
  98.     PORT_DIPSETTING(    0x40, "2" )
  99.     PORT_DIPSETTING(    0x00, "4" )
  100.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Demo_Sounds ) )
  101.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  102.     PORT_DIPSETTING(    0x80, DEF_STR( On ) )
  103. INPUT_PORTS_END
  104.  
  105.  
  106.  
  107. static struct GfxLayout charlayout =
  108. {
  109.     8,8,    /* 8 by 8 */
  110.     4096,   /* 4096 characters */
  111.     3,        /* 3 bits per pixel */
  112.     { 2*4096*8*8, 4096*8*8, 0 },    /* plane */
  113.     { 0, 1, 2, 3, 4, 5, 6, 7 },        /* x bit */
  114.     { 8*0, 8*1, 8*2, 8*3, 8*4, 8*5, 8*6, 8*7 },     /* y bit */
  115.     8*8
  116. };
  117.  
  118.  
  119.  
  120. static struct GfxDecodeInfo gfxdecodeinfo[] =
  121. {
  122.     { REGION_GFX1, 0x0000, &charlayout,  0 , 32 },
  123.     { -1 } /* end of array */
  124. };
  125.  
  126.  
  127.  
  128. static struct AY8910interface ay8910_interface =
  129. {
  130.     1,    /* 1 chip */
  131.     1500000,    /* 1.5 MHz ???? */
  132.     { 50 },
  133.     { input_port_0_r },
  134.     { input_port_1_r },
  135.     { 0 },
  136.     { 0 }
  137. };
  138.  
  139.  
  140.  
  141. static struct MachineDriver machine_driver_hexa =
  142. {
  143.     /* basic machine hardware */
  144.     {
  145.         {
  146.             CPU_Z80,
  147.             4000000,        /* 4 MHz ??????? */
  148.             readmem,writemem,0,0,
  149.             interrupt,1
  150.         }
  151.     },
  152.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  153.     1,                    /* single CPU, no need for interleaving */
  154.     0,
  155.  
  156.     /* video hardware */
  157.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  158.     gfxdecodeinfo,
  159.     256, 256,
  160.     hexa_vh_convert_color_prom,
  161.  
  162.  
  163.     VIDEO_TYPE_RASTER | VIDEO_SUPPORTS_DIRTY,
  164.     0,                    /* vh_init routine */
  165.     generic_vh_start,        /* vh_start routine */
  166.     generic_vh_stop,        /* vh_stop routine */
  167.     hexa_vh_screenrefresh,    /* vh_update routine */
  168.  
  169.     /* sound hardware */
  170.     0,0,0,0,
  171.     {
  172.         {
  173.             SOUND_AY8910,
  174.             &ay8910_interface
  175.         }
  176.     }
  177. };
  178.  
  179.  
  180.  
  181. /***************************************************************************
  182.  
  183.   Game driver(s)
  184.  
  185. ***************************************************************************/
  186.  
  187. ROM_START( hexa )
  188.     ROM_REGION( 0x18000, REGION_CPU1 )        /* 64k for code + 32k for banked ROM */
  189.     ROM_LOAD( "hexa.20",      0x00000, 0x8000, 0x98b00586 )
  190.     ROM_LOAD( "hexa.21",      0x10000, 0x8000, 0x3d5d006c )
  191.  
  192.     ROM_REGION( 0x18000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  193.     ROM_LOAD( "hexa.17",      0x00000, 0x8000, 0xf6911dd6 )
  194.     ROM_LOAD( "hexa.18",      0x08000, 0x8000, 0x6e3d95d2 )
  195.     ROM_LOAD( "hexa.19",      0x10000, 0x8000, 0xffe97a31 )
  196.  
  197.     ROM_REGION( 0x0300, REGION_PROMS )
  198.     ROM_LOAD( "hexa.001",     0x0000, 0x0100, 0x88a055b4 )
  199.     ROM_LOAD( "hexa.003",     0x0100, 0x0100, 0x3e9d4932 )
  200.     ROM_LOAD( "hexa.002",     0x0200, 0x0100, 0xff15366c )
  201. ROM_END
  202.  
  203.  
  204.  
  205. static void init_hexa(void)
  206. {
  207.     unsigned char *RAM = memory_region(REGION_CPU1);
  208.  
  209.  
  210.     /* Hexa is not protected or anything, but it keeps writing 0x3f to register */
  211.     /* 0x07 of the AY8910, to read the input ports. This causes clicks in the */
  212.     /* music since the output channels are continuously disabled and reenabled. */
  213.     /* To avoid that, we just NOP out the 0x3f write. */
  214.     RAM[0x0124] = 0x00;
  215.     RAM[0x0125] = 0x00;
  216.     RAM[0x0126] = 0x00;
  217. }
  218.  
  219.  
  220. GAME( ????, hexa, 0, hexa, hexa, hexa, ROT0, "D. R. Korea", "Hexa" )
  221.